import requests
import json

# headers = {'Content-Type': 'application/json'}

# gpt = {"text":"测试测试，这里是测试","speaker":"阿星(粤语)","new":1,"streaming":1}

# response = requests.post("http://localhost:9233/",data=json.dumps(gpt),headers=headers)

# data={
#     "text":"你好啊亲爱的朋友们。",
#     "reference_audio":"10.wav",
#     "reference_text":"希望你过的比我更好哟。"
# }

# response=requests.post(f'http://127.0.0.1:9233/tts',data=data,timeout=3600)


# audio_data = response.content

# with open(f"post请求测试.wav","wb") as f:
#     f.write(audio_data)
    
data = {
    "text": "In a village near a jungle, there lived a curious girl named Tippi. She loved exploring and had a special ability to talk to animals. One sunny morning, Tippi decided to visit her animal friends.",
    "reference_audio": "./参考音频/光动嘴不如亲自做给你看_xixi.m4a",  # 参考音频路径
    "reference_text": "光动嘴不如亲自做给你看。",
    "speed": 1.2  # 默认速度
}
response = requests.post('http://127.0.0.1:9233/clone_eq', data=data, timeout=3600)

if response.status_code == 200:
    with open(f"mytest.wav", "wb") as f:
        f.write(response.content)
